package com.itxiao.util;

import com.wechat.pay.java.core.RSAAutoCertificateConfig;

/**
 * @Author xjy
 * @Date 2024/11/13 14:51
 */

public class WePayUtil {
   private static RSAAutoCertificateConfig rsaAutoCertificateConfig;
   /** 商户号 */
   public static String merchantId = "1663753442";
   /** 商户API私钥路径 */
   public static String privateKeyPath = "E:\\1663753442_20231222_cert\\apiclient_key.pem";
   /** 商户证书序列号 */
   public static String merchantSerialNumber = "48A303621E9EE3802AC3D102B00CBEA9045215E4";
   /** 商户APIV3密钥 */
   public static String apiV3Key = "RCaondmero12ndmu983B3YncIUPv1G6R";
   public static RSAAutoCertificateConfig getConfig() {
      if (rsaAutoCertificateConfig == null) {
         rsaAutoCertificateConfig = new RSAAutoCertificateConfig.Builder()
                 .merchantId(merchantId)
                 .privateKeyFromPath(privateKeyPath)
                 .merchantSerialNumber(merchantSerialNumber)
                 .apiV3Key(apiV3Key)
                 .build();
      }
      return rsaAutoCertificateConfig;
   }
}
